<!DOCTYPE html>
<html lang="en">
<head>
	<include data="head.html">
	<import data="js/date.js">
	<title>{$title}</title>
	<style>
	h4{white-space: normal;}
	#file-list-div{min-height: 20px;}
	#file-modal-picture .modal-body{text-align: center;}
	#file-modal-picture .modal-body img{max-width: 100%; max-height: 100%;}
	</style>
</head>
<body data-menu="files">
	<div class="container">
		<ul class="nav nav-tabs" role="tablist" id="file-list-tabs">
			<if data="IS_AUTH">
				<li role="presentation">
					<a href="files.html">所有文件({$fileCount['all']})</a>
				</li>
			</if>
			<li role="presentation" data="person">
				<a href="files.html?user_id={@$_GET['user_id'] ?: me_id()}&tablist=person">{$person}的文件({$fileCount['person']})</a>
			</li>
			<if data="!empty($_GET['file_id'])">
				<li role="presentation" class="active">
					<a href="#">当前文件</a>
				</li>
			</if>
		</ul>
		<div id="file-list-div">
			<while data="get_multi_file($_GET)">
				<div class="media" data-id="{file_id()}">
					<div class="media-left">
						<div class="media-logo">
							{admin_get_file_icon()}
						</div>
					</div>
					<div class="media-body">
						<h4 class="media-heading">
							{file_name()}
						</h4>
						<p class="media-content">
							{file_desc()}
						</p>
						<p class="media-meta">
							<if data="empty($_GET['user_id'])">
								<if data="IS_AUTH">
									<a title="查看此人的文件" href="files.html?user_id={file_user('id')}&tablist=person">
										{file_user('nickname') ?: file_user('name')}
									</a>
									<else>
										{file_user('nickname') ?: file_user('name')}
									</else>
								</if>
							</if>
							 上传于 {date('Y-m-d', file_time())}
						</p>
					</div>
				</div>
			</while>
		</div>
	</div>
	<div class="modal fade" id="file-modal">
		<div class="modal-dialog">
			<form action="{site_url()}mod.php?file::update" method="post">
				<input type="hidden" name="file_id">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
						<h4 class="modal-title">编辑文件</h4>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<label for="file_name">文件名</label>
							<input type="text" class="form-control" name="file_name" id="file_name" required>
						</div>
						<div class="form-group">
							<label for="file_desc">描述</label>
							<textarea name="file_desc" id="file_desc" rows="2" class="form-control" placeholder="简单地介绍这个文件的来源和用途"></textarea>
						</div>
					</div>
					<div class="modal-footer">
						<button type="submit" class="btn btn-success">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="modal fade" id="file-modal-picture">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
					<h4 class="modal-title">文件名</h4>
				</div>
				<div class="modal-body">
					<img src="" alt="无法加载图片">
				</div>
			</div>
		</div>
	</div>
	<script>
		TOTAL = {_file('total') ?: 0};
		PAGES = {_file('pages') ?: 0};
	</script>
	<include data="foot.html">
</body>
</html>